<!doctype html>
<%@page import="com.cn.ccp.util.Contants"%>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<f:view>
	<f:loadBundle var="messages" basename="messages"></f:loadBundle>
	<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" />
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- styles -->
<link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
<link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
<link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
<!--[if lt IE 9]>
      <script src="../../../js/html5.js"></script>
    <![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"  href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
<link href="<%=request.getContextPath()%>/css/upload/default.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/upload/uploadify.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/upload/swfobject.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/upload/jquery.uploadify.v2.0.1.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/themes/default/default.css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/code/prettify.css" />
<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/lang/zh_CN.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/plugins/code/prettify.js"></script>	
<script type="text/javascript" src="<%=request.getContextPath()%>/flexpaper/js/flexpaper_flash.js"></script>	
<%
	int uid = 0;
		String imageType = (String) session
				.getAttribute(Contants.FILE_TYPE_IMAGE);
		UserBean users = (UserBean) session.getAttribute("userBean");
		if ((users == null) || (users.getUserName().equals(""))) {
		} else {
			uid = users.getId();
		}
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":"+ request.getServerPort() + path + "/";
	
	String  outline = (String)session.getAttribute("outlineFilePath") ;
	
	String  eval = (String)session.getAttribute("evaluFilePath") ;
		
	String outlineUrl = basePath + "tempfile/outline/"+session.getAttribute("outlineFilePath");
	
	
	String evaluUrl = basePath + "tempfile/evaluation/"+session.getAttribute("evaluFilePath");
	
	String  outlineIsPDF = ""+outlineUrl.toUpperCase().endsWith(".PDF");
	String evaluIsPDF = ""+evaluUrl.toUpperCase().endsWith(".PDF");
%>
<script type="text/javascript">
	var imageType = '<%=imageType%>' ;
		var uploadFileName = "";
		function insertTitle(tValue){ 
			exts = tValue.split(".");
			if(exts.length < 1){
				alert("错误，请上传正确的文件");
				return ;
			}
			ext = exts[1].toUpperCase();
			imageLayout = document.getElementById("imagelayoutId").value.toUpperCase() ;
			if(imageLayout.indexOf(ext) == -1){
				alert("错误，请上传正确的文件格式");
				return ;
			}
			uploadFileName = tValue ;
		  // var t1 = tValue.lastIndexOf("\\");  
		   //var t2 = tValue.lastIndexOf(".");  
		   //if(t1 >= 0 && t1 < t2 && t1 < tValue.length){  
		   // document.getElementById("file").value = tValue.substring(t1 + 1, t2);  
		  // }  
		}        
		function uploadFormSubmit(){
			if(uploadFileName == ''){
				return false;
			}
			return true ;
		}
		$(document).ready(function() {
			$("#uploadify").uploadify({
				'uploader'       : '<%=request.getContextPath()%>/flexpaper/uploadify.swf',
				//'script'         : 'upload!doUpload.action',
				'script'         : '<%=basePath%>/servlet/Upload?uid='+<%=uid%>,
				'cancelImg'      : '<%=request.getContextPath()%>/images/cancel.png',
				'folder'         : 'uploads',
				'queueID'        : 'fileQueue',
				'auto'           : true,
				'multi'          : false,
				'simUploadLimit' : 1,
				'buttonText'	 : 'upload' ,
				'fileDesc'       : '支持格式:'+imageType, //如果配置了以下的'fileExt'属性，那么这个属性是必须的  
                'fileExt'        : imageType,//允许的格式 
				'onComplete': function (event, queueID, fileObj, response, data) {  
					isAllowSubmit = true ;
					//alert($("#formid:hiddenImagePath").val());
					document.getElementById("formid:hiddenImagePath").value = response ;
					$("#courseImageId").show();
					var url = "tempfile/"+response ;
					document.getElementById("courseImageId").innerHTML = "<img src=" + url + " height='156px' width='196px' />";
                },  
                'onError': function(event, queueID, fileObj) {  
                	isAllowSubmit = true ;
                	$("#formid:imageError").val("上传文件失败");
					$("#courseImageId").show();
                },  
                'onCancel': function(event, queueID, fileObj){  
                	isAllowSubmit = true ;
        			$("#courseImageId").show();
                } ,
                'onSelect': function(event, queueID, fileObj){  
                	isAllowSubmit = false ;
        			$("#courseImageId").hide();
                }  
			});
			//var image = document.getElementById("formid:hiddenImagePath").value;
			//if(image != ''){
				//var url = "../../../tempfile/"+image ;
				//document.getElementById("courseImageId").innerHTML = "<img src=" + url + " height='156px' width='196px' />";
			//}
			$("#courseImageId").show();
		});
		
		function onloadInit(){
			var flag = document.getElementById("formid:courseName") ;
			if(flag.disabled){  
				$("#uploadButtonId").hide();
				$("#showFileId").hide();
			}
			var courseId = document.getElementById("formid:hiddenCourseId").value ;
			if(courseId != null && courseId != '')
				$("#courseContentDivId").show();
			
			
		}
		var isAllowSubmit = true ;
		function checkSubmit(){
			if(!isAllowSubmit){
				alert("文件正在上传，请稍后提交。");
				return false;
			}	
		}
		
		
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : '<%=basePath%>/plugins/code/prettify.css',
				uploadJson : '<%=basePath%>/jsp/upload_json.jsp',
				fileManagerJson : '<%=basePath%>/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						//document.forms['example'].submit();
						document.getElementById("formid").submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.getElementById("formid").submit();
						//document.forms['example'].submit();
					});
				},
				afterChange : function() {  
		            K('.word_count1').html(this.count());  
		            K('.word_count2').html(this.count('text')); 
		            
		        }  
			});
			 editor1.statusbar.remove(); 
			 prettyPrint();
			
		});
		
	</script>
		<base href="<%=basePath%>">
	</head>
	<h:inputHidden value="#{courseAction.initData}"></h:inputHidden>
	<body class="bg-white" onload="onloadInit();" style="overflow-x:hidden;">
		<h:form id="formid" styleClass="form-horizontal"
			style="margin-left: 20px;margin-right: 20px">
			<h:inputHidden id="hiddenImagePath" value="#{courseAction.courseBean.image}"></h:inputHidden>
			<h:inputHidden id="hiddenCourseId" value="#{courseAction.courseBean.id}"></h:inputHidden>
			<h:inputHidden  value="#{courseAction.courseBean.status}"></h:inputHidden> 
			<h:inputHidden  value="#{courseAction.showEditOutline}" id="showEditOutlineFlagId"></h:inputHidden>
			<h:inputHidden  value="#{courseAction.showEditEvaluation}" id="showEditEvaluationId"></h:inputHidden>
			<div class="row page-head">
				<h3 class="page-title">
					<i class="n-icon-selection  n-icon-black"></i>
					<h:outputText value="#{messages['course_page_title']}" />
					&nbsp;&gt;&nbsp;<b><h:outputText
							value="#{messages['course_page_title_edit']}" />
					</b>
				</h3>
			</div>
			<fieldset>
				<legend>
					<h:outputText value="#{messages['basic_info']}"></h:outputText>
				</legend>
				<div class="form-white">
					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_page_course_name']}" />
						</label>
						<div class="controls">
							<h:inputText id="courseName"
								value="#{courseAction.courseBean.course_name}"
								disabled="#{courseAction.disabled}"></h:inputText>
							<span class="help-inline"><h:message for="courseName"
									style="color:red" />
							</span>
						</div>
					</div>

					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['teaching_group_pages_title']}" />
						</label>
						<div class="controls">
							<h:selectOneMenu id="specialty"
								value="#{courseAction.courseBean.teaching_group_id}"
								disabled="#{courseAction.disabled}">
								<f:selectItems value="#{courseAction.teachingGroupSelect}" />
							</h:selectOneMenu>
							<span class="help-inline"><h:message for="specialty"
									style="color:red" />
							</span>
						</div>
					</div>

					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['pages_resourse_type_course']}" />
						</label>
						<div class="controls">
							<h:selectOneMenu id="courseTypeSelect"
								value="#{courseAction.courseBean.keys}"
								disabled="#{courseAction.disabled}">
								<f:selectItem itemLabel="#{messages['messages_select']}"
									itemValue="-1" />
								<f:selectItems value="#{courseAction.courseTypeSelect}" />
							</h:selectOneMenu>
							<span class="help-inline"><h:message
									for="courseTypeSelect" style="color:red" />
							</span>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_page_course_language_type']}" />
						</label>
						<div class="controls">
							<h:selectOneMenu id="languageTypeSelect"
								value="#{courseAction.courseBean.language_type}"
								disabled="#{courseAction.disabled}">
								<f:selectItems value="#{courseAction.courseLangeageSelect}" />
							</h:selectOneMenu>
							<span class="help-inline"><h:message
									for="languageTypeSelect" style="color:red" />
							</span>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_page_course_resourse']}" />
						</label>
						<div class="controls">
							<h:inputText id="courseResourse"
								value="#{courseAction.courseBean.courseResourse}"
								disabled="#{courseAction.disabled}"></h:inputText>
							<span class="help-inline"><h:message for="courseResourse"
									style="color:red" />
							</span>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_page_course_is_completed']}" />
						</label>
						<div class="controls">
							<h:selectOneMenu id="completed"
								value="#{courseAction.courseBean.completed}"
								disabled="#{courseAction.disabled}">
								<f:selectItem itemValue="0" itemLabel="#{messages['course_page_course_is_completed_no']}" />
								<f:selectItem itemValue="1" itemLabel="#{messages['course_page_course_is_completed_yes']}" />
							</h:selectOneMenu>
							<span class="help-inline"><h:message
									for="completed" style="color:red" />
							</span>
						</div>
					</div>
					
					

					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_content_page_file_type']}" />
						</label>
						<div class="controls">
							<h:outputText value="#{publicAction.imageLayout}"></h:outputText>
							<span class="help-inline"><h:outputText />
							</span>
						</div>
					</div>

					<div class="control-group" id="uploadButtonId">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_page_course_image_first']}" />
						</label>
						<div class="controls">
							<input type="file" name="uploadify" id="uploadify" /> <span
								class="help-inline"><h:outputText></h:outputText>
							</span>
							<h:outputText value="#{messages['course_page_course_image_size_des']}"></h:outputText>
						</div>
					</div>

					<div class="control-group" id="showFileId">
						<label class="control-label" for=""><h:outputText
								id="image" value=""></h:outputText>
						</label>
						<div class="controls">
							<div id="fileQueue" style="height: 60px"></div>
							<span class="help-inline"><h:outputText id="imageError"></h:outputText>
							</span>
						</div>
					</div>

					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								id="image" value=""></h:outputText>
						</label>
						<div class="controls">
							<div id="courseImageId">
								<h:graphicImage url="/tempfile/#{courseAction.courseBean.image}" height="190px" width="156px"></h:graphicImage>
							</div>
							<span class="help-inline"><h:outputText id="imageError"></h:outputText>
							</span>
						</div>
					</div>

					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								value="#{messages['course_page_course_des']}" />
						</label>
						<div class="controls">
							 <textarea name="content1" id="outlineContentsID" cols="100" rows="8" style="width:70%;height:20px;visibility:hidden;">
                         		<h:outputText value="#{courseAction.courseBean.descripte}"/>
                         	</textarea>
                         	
						</div>
					</div>

					<div class="control-group">
						<label class="control-label" for=""><h:outputText
								id="image" value=""></h:outputText>
						</label>
						<div class="controls">
							<h:outputText id="hiddeninfo"></h:outputText>
							<span class="help-inline"><h:message for="hiddeninfo"
									style="color:red" />
							</span>
						</div>
					</div>
				</div>
			</fieldset>
			<fieldset>
				<div class="form-actions">
					<h:commandButton value="#{messages['btn_submit']}"
						styleClass="btn btn-primary" action="#{courseAction.edit}"
						onclick="return checkSubmit();"
						rendered="#{courseAction.hiddenButton}" />
					<h:commandButton
						value="#{messages['course_page_course_submit_approve']}"
						styleClass="btn btn-primary"
						action="#{courseAction.submitCourseApprove}"
						rendered="#{courseAction.showSubmitApproveButton}" />
					<h:commandButton value="#{messages['btn_cancel']}" action="main"
						styleClass="btn" immediate="true" />
				</div>
			</fieldset>
			
			<div id="courseContentDivId" style="display: none">
				<ul class="nav nav-tabs" id="myTab">
					<li class="active"><a href="#courseContent"><h:outputText id="contentA" value="#{messages['online_page_select_action_browse_tab_course']}" /></a></li>
					<li><a href="#courseOutline" onclick="onLoadOutline();"><h:outputText id="outlineA" value="#{messages['course_page_course_outline_title']}" /></a></li>
					<li><a href="#assessment" onclick="onLoadEvalu();"><h:outputText id="assessmentA" value="#{messages['course_page_course_evaluation_title']}" /></a></li>
					<li><a href="#courseNotice" ><h:outputText id="noticeA" value="#{messages['course_page_course_notice_btn']}" /></a></li>
					<li><a href="#courseSurvey" ><h:outputText id="surveyA" value="#{messages['course_page_course_survey_title']}" /></a></li>
					<li><a href="#coursePractice" ><h:outputText id="practiceA" value="#{messages['course_page_course_training']}" /></a></li>
					<li><a href="#courseTest" ><h:outputText id="testA" value="#{messages['course_page_course_test']}" /></a></li>
				</ul>
				
				<div class="tab-content">
					<div class="tab-pane active" id="courseContent">
						<div class="list-white">
							<h:commandButton
								value="#{messages['course_page_course_content_add']}"
								styleClass="btn btn-primary"
								action="#{courseAction.goAddCourseContent}" 
								rendered="#{courseAction.hiddenButton}" />
							<div class="accordion" id="accordion1">
								<!-- accordion -->
								<a4j:outputPanel id="refresh">
									<a4j:repeat var="content"
										value="#{courseAction.courseChapterList}">
										<h:outputText value="#{content.title1}" escape="false"></h:outputText>
	
										<h:outputText value="#{content.title2}" escape="false"></h:outputText>
	
										<a4j:repeat var="contentVar" value="#{content.ccList}">
											<f:verbatim>
												<li>
											</f:verbatim>
	
											<a4j:commandLink action="#{courseAction.goUp}"
												style="margin-left: 10px"
												rendered="#{courseAction.hiddenButton}" reRender="refresh"
												styleClass="icon-arrow-up">
												<f:param name="chapterId" value="#{contentVar.id}" />
												<f:param name="type" value="2" />
											</a4j:commandLink>
	
											<a4j:commandLink action="#{courseAction.goDown}"
												style="margin-left: 10px"
												rendered="#{courseAction.hiddenButton}" reRender="refresh"
												styleClass="icon-arrow-down">
												<f:param name="chapterId" value="#{contentVar.id}" />
												<f:param name="type" value="2" />
											</a4j:commandLink>
	
											<a4j:commandLink styleClass="icon-trash"
												action="#{courseAction.deleteCourseContent}"
												style="margin-left: 10px"
												onclick="if(!confirm('#{messages['label_delete_sure']}？')){return false;}"
												reRender="refresh" rendered="#{courseAction.hiddenButton}">
												<f:param name="chapterId" value="#{contentVar.id}"></f:param>
												<f:param name="chapterNumber"
													value="#{contentVar.chapter_number}"></f:param>
												<f:param name="imagePath"
													value="#{contentVar.source_file_url}"></f:param>
												<f:param name="type" value="2"></f:param>
											</a4j:commandLink>
	
											<h:commandLink style="margin-left: 20px"
												value="#{contentVar.section_file_name}[#{contentVar.section_file_type}]"
												action="#{courseAction.goUpdateCourseContent}"
												rendered="#{courseAction.hiddenButton}">
												<f:param name="chapterId" value="#{contentVar.id}"></f:param>
											</h:commandLink>
											
											<h:commandLink style="margin-left: 20px"
												value="#{contentVar.section_file_name}[#{contentVar.section_file_type}]"
												action="#{courseAction.showCourseContentFile}"
												rendered="#{courseAction.hiddenShowCourseContentFile}">
												<f:param name="chapterId" value="#{contentVar.id}"></f:param>
											</h:commandLink>
	
											<f:verbatim>
												</li>
											</f:verbatim>
										</a4j:repeat>
										
										<a4j:repeat var="cmVar" value="#{content.xjMList}">
											<f:verbatim>
												<li>
											</f:verbatim>
											<h:outputText value="#{cmVar.xtitle1}" escape="false"></h:outputText>
												<a4j:repeat var="mv" value="#{cmVar.ccmList}">
													<f:verbatim>
														<li>
													</f:verbatim>
													<a4j:commandLink action="#{courseAction.goUp}"
														style="margin-left: 10px"
														rendered="#{courseAction.hiddenButton}" reRender="refresh"
														styleClass="icon-arrow-up">
														<f:param name="chapterId" value="#{mv.id}" />
														<f:param name="type" value="3" />
													</a4j:commandLink>
												
													<a4j:commandLink action="#{courseAction.goDown}"
														style="margin-left: 10px"
														rendered="#{courseAction.hiddenButton}" reRender="refresh"
														styleClass="icon-arrow-down">
														<f:param name="chapterId" value="#{mv.id}" />
														<f:param name="type" value="3" />
													</a4j:commandLink>
												
													<a4j:commandLink styleClass="icon-trash"
														action="#{courseAction.deleteCourseContent}"
														style="margin-left: 10px"
														onclick="if(!confirm('#{messages['label_delete_sure']}？')){return false;}"
														reRender="refresh" rendered="#{courseAction.hiddenButton}">
														<f:param name="chapterId" value="#{mv.id}"></f:param>
														<f:param name="chapterNumber"
															value="#{mv.chapter_number}"></f:param>
														<f:param name="imagePath"
															value="#{mv.source_file_url}"></f:param>
														<f:param name="type" value="4"></f:param>
													</a4j:commandLink>
												
													<h:commandLink style="margin-left: 20px"
														value="#{mv.section_file_name}[#{mv.section_file_type}]"
														action="#{courseAction.goUpdateCourseContent}"
														rendered="#{courseAction.hiddenButton}">
														<f:param name="chapterId" value="#{mv.id}"></f:param>
													</h:commandLink>
												
													<h:commandLink style="margin-left: 20px"
														value="#{mv.section_file_name}[#{mv.section_file_type}]"
														action="#{courseAction.showCourseContentFile}"
														rendered="#{courseAction.hiddenShowCourseContentFile}">
														<f:param name="chapterId" value="#{mv.id}"></f:param>
													</h:commandLink>
													<f:verbatim>
														</li>
													</f:verbatim>
												</a4j:repeat>
											<h:outputText value="#{cmVar.xtitle2}" escape="false"></h:outputText>
											<f:verbatim>
												</li>
											</f:verbatim>
										
										</a4j:repeat>
										
										<h:outputText value="#{content.title3}" escape="false"></h:outputText>
									</a4j:repeat>
								</a4j:outputPanel>
							</div>
							<!-- /.accordion -->
						</div>
					</div>
					<div class="tab-pane" id="coursePractice">
						<div class="list-white">
							<h:commandLink action="#{courseSetAction.goAdd}" styleClass="btn btn-primary"  rendered="#{courseAction.hiddenButton}" >
								<h:outputText value="#{messages['btn_add']}" ></h:outputText>
								<f:param name="courseId" value="#{courseAction.courseBean.id}" />
								<f:param name="type" value="2" />
							</h:commandLink>
							<div class="table-white">
								<h:dataTable id="listtableinfo"
									value="#{courseAction.trainingCourseList}" var="cour" cellpadding="2"
									cellspacing="1" styleClass="table table-hover" >
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										<h:outputText value=""></h:outputText>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['label_title']}"></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{courseSetAction.goAdd}" styleClass="text-info" >
											<h:outputText value="#{cour.title}"></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="type" value="2" />
										</h:commandLink>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{courseTrainingAction.showCourseTraining}" >
											<h:outputText value="#{messages['course_page_course_training_info']}" ></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="type" value="#{cour.type}" />
										</h:commandLink>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['course_page_create_time']}"></h:outputText>
										</f:facet>
										
										<h:outputText value="#{cour.createtime}"></h:outputText>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['online_page_select_action_look']}"></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{homeworkAction.showHomeworkReportList}" >
											<h:outputText value="#{messages['online_page_select_action_look']}"></h:outputText>
											<f:param name="settingId" value="#{cour.id}" />
											<f:param name="courseId" value="#{courseAction.courseBean.id}" />
											<f:param name="type" value="#{cour.type}" />
										</h:commandLink>
									</h:column>
								</h:dataTable>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="courseTest">
						<div class="list-white">
							<h:commandLink action="#{courseSetAction.goAdd}" styleClass="btn btn-primary"  rendered="#{courseAction.hiddenButton}" >
								<h:outputText value="#{messages['btn_add']}" ></h:outputText>
								<f:param name="courseId" value="#{courseAction.courseBean.id}" />
								<f:param name="type" value="1" />
							</h:commandLink>
							<div class="table-white">
								<h:dataTable id="listtableinfoTest"
									value="#{courseAction.courseTestList}" var="cour" cellpadding="2"
									cellspacing="1" styleClass="table table-hover" >
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										<h:outputText value=""></h:outputText>
									</h:column>
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['label_title']}"></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{courseSetAction.goAdd}" styleClass="text-info" >
											<h:outputText value="#{cour.title}"></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="type" value="1" />
										</h:commandLink>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{courseTrainingAction.showCourseTraining}" >
											<h:outputText value="#{messages['course_page_course_test_info']}" ></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="type" value="#{cour.type}" />
										</h:commandLink>
									</h:column>
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['course_page_course_set_use_status']}"></h:outputText>
										</f:facet>
										
										<a4j:commandLink action="#{courseSetAction.activeChange}" reRender="listtableinfoTest" styleClass="text-error" >
											<h:outputText value="#{cour.activeName}" ></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="courseId" value="#{courseAction.courseBean.id}" />
											<f:param name="selectType" value="1" />
											<f:param name="active" value="#{cour.active}" />
										</a4j:commandLink>
									</h:column>
									
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['course_page_create_time']}"></h:outputText>
										</f:facet>
										
										<h:outputText value="#{cour.createtime}"></h:outputText>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['course_page_update_time']}"></h:outputText>
										</f:facet>
										
										<h:outputText value="#{cour.updatetime}"></h:outputText>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{homeworkAction.showHomeworkReportList}" >
											<h:outputText value="#{messages['online_page_select_action_look']}"></h:outputText>
											<f:param name="settingId" value="#{cour.id}" />
											<f:param name="courseId" value="#{courseAction.courseBean.id}" />
											<f:param name="type" value="1" />
										</h:commandLink>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['btn_delete']}"></h:outputText>
										</f:facet>
										
										<a4j:commandLink action="#{courseAction.doDeleleTest}" reRender="listtableinfoTest" >
											<h:outputText value="#{messages['btn_delete']}"></h:outputText>
											<f:param name="settingId" value="#{cour.id}" />
											<f:param name="courseId" value="#{courseAction.courseBean.id}" />
										</a4j:commandLink>
									</h:column>
									
								</h:dataTable>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="courseSurvey">
						<div class="list-white">
							<h:commandLink action="#{courseSetAction.goAdd}" styleClass="btn btn-primary" >
								<h:outputText value="#{messages['btn_add']}" ></h:outputText>
								<f:param name="courseId" value="#{courseAction.courseBean.id}" />
								<f:param name="type" value="3" />
							</h:commandLink>
							<div class="table-white">
								<h:dataTable id="listtableinfosu"
									value="#{courseAction.courseSurveyList}" var="cour" cellpadding="2"
									cellspacing="1" styleClass="table table-hover" >
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										<h:outputText value=""></h:outputText>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['label_title']}"></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{courseSetAction.goAdd}" styleClass="text-info" >
											<h:outputText value="#{cour.title}"></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="type" value="3" />
										</h:commandLink>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value=""></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{courseTrainingAction.showCourseTraining}" >
											<h:outputText value="#{messages['course_page_course_Survey_info']}" ></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="type" value="#{cour.type}" />
										</h:commandLink>
									</h:column>
									
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['course_page_course_set_use_status']}"></h:outputText>
										</f:facet>
										
										<a4j:commandLink action="#{courseSetAction.activeChange}" reRender="listtableinfosu" styleClass="text-error" >
											<h:outputText value="#{cour.activeName}" ></h:outputText>
											<f:param name="id" value="#{cour.id}" />
											<f:param name="courseId" value="#{courseAction.courseBean.id}" />
											<f:param name="selectType" value="3" />
											<f:param name="active" value="#{cour.active}" />
										</a4j:commandLink>
									</h:column>
									
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['course_page_create_time']}"></h:outputText>
										</f:facet>
										
										<h:outputText value="#{cour.createtime}"></h:outputText>
									</h:column>
									
									<h:column>
										<f:facet name="header">
											<h:outputText value="#{messages['online_page_select_action_look']}"></h:outputText>
										</f:facet>
										
										<h:commandLink action="#{evaluationAction.goEvaluationReportPages}" >
											<h:outputText value="#{messages['online_page_select_action_look']}"></h:outputText>
											<f:param name="settingId" value="#{cour.id}" />
											<f:param name="courseId" value="#{courseAction.courseBean.id}" />
										</h:commandLink>
									</h:column>
									
								</h:dataTable>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="courseNotice">
						<div class="list-white">
							<h:commandLink action="#{courseAction.viewNotices}" styleClass="btn btn-primary" >
								<h:outputText value="#{messages['btn_add']}" ></h:outputText>
								<f:param name="id" value="#{courseAction.courseBean.id}" />
							</h:commandLink>
							<div class="table-white">
								<a4j:outputPanel ajaxRendered="true">
		          					<a4j:repeat id="repeatid" var="content" value="#{courseAction.noticeList}" >
		          						<f:verbatim>
		          							<div class="alert alert-info">
			                            </f:verbatim>
			                            <h:outputText value="#{content.notice}" escape="false" ></h:outputText>
			                            <f:verbatim>
			                            	<br/>
			                            	<strong>
			                            </f:verbatim>
			                            <h:outputText value="#{content.createTime}" escape="false" ></h:outputText>
			                            <f:verbatim>
			                           		 </strong>
			 								</div>
			                          	</f:verbatim>
			          				</a4j:repeat>
			          			</a4j:outputPanel>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="courseOutline">
						<div class="list-white">
							<h:commandLink rendered="#{courseAction.hiddenButton}" 
								value="#{messages['btn_edit']}"
								styleClass="btn btn-primary"
								action="#{courseAction.goEditOutline}">
								<f:param name="id" value="#{courseAction.courseBean.id}" />
							</h:commandLink>
							<h:commandLink rendered="#{courseAction.hiddenButton}" 
								value="#{messages['course_page_course_outline_upload_title']}"
								styleClass="btn btn-primary"
								action="#{courseAction.goUploadOutline}">
								<f:param name="id" value="#{courseAction.courseBean.id}" />
							</h:commandLink>
							 <br/><br/>
							  
								<h:outputText value="#{courseAction.courseOutline}" escape="false" rendered="#{courseAction.showEditOutline}"></h:outputText>
							 
							
							<%
								String url = outlineUrl.toUpperCase() ;
								if(url.endsWith(".PDF")){
							%>
								<div id="pdfDivID" style="margin-left:60px;width:900px;height:800px;display: none">
									<!--[if IE]>  
									    <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="1050" border="0">   
									        <param name="_Version" value="65539">  <param name="_ExtentX" value="20108">  
									        <param name="_ExtentY" value="10866">  <param name="_StockProps" value="0">  
									        <param name="SRC" value="<%=outlineUrl%>">  
									    </object>  
									 <![endif]-->
									 <!--[if !IE]> <!-->  
										<object data="<%=outlineUrl%>" type="application/pdf" width="100%" height="800px">  
									    	alt : <a href='http://get.adobe.com/cn/reader'>Adobe Reader.pdf </a>  
									    </object> 
									 <!-- <![endif]-->
								</div>
							<%
								}else{
							%>
								<div id="viewerPlaceHolder" style="display: none;width:900px;height:800px;"> </div>  
							<%
								}
							%>
						</div> 
					</div>
					<div class="tab-pane" id="assessment">
						<div class="list-white">
							<h:commandLink rendered="#{courseAction.hiddenButton}" 
								value="#{messages['btn_edit']}"
								styleClass="btn btn-primary"
								action="#{courseAction.goEditEvaluation}">
								<f:param name="id" value="#{courseAction.courseBean.id}" />
							</h:commandLink>
							<h:commandLink rendered="#{courseAction.hiddenButton}" 
								value="#{messages['course_page_course_evaluation_upload_title']}"
								styleClass="btn btn-primary"
								action="#{courseAction.goUploadEvaluation}">
								<f:param name="id" value="#{courseAction.courseBean.id}" />
							</h:commandLink>
							<br/>
							<br>
								 
									<h:outputText value="#{courseAction.courseAssessment}" escape="false" rendered="#{courseAction.showEditEvaluation}"></h:outputText>
						    	 
						    	<%
									String vurl = evaluUrl.toUpperCase() ;
									if(vurl.endsWith(".PDF")){
								%>
									<div id="pdfEvaluDivID" style="margin-left:60px;width:900px;height:800px;display: none">
										<!--[if IE]>  
										    <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="1050" border="0">   
										        <param name="_Version" value="65539">  <param name="_ExtentX" value="20108">  
										        <param name="_ExtentY" value="10866">  <param name="_StockProps" value="0">  
										        <param name="SRC" value="<%=evaluUrl%>">  
										    </object>  
										 <![endif]-->
										 <!--[if !IE]> <!-->  
											<object data="<%=evaluUrl%>" type="application/pdf" width="100%" height="800px">  
										    	alt : <a href='http://get.adobe.com/cn/reader'>Adobe Reader.pdf </a>  
										    </object> 
										 <!-- <![endif]-->
									</div>
								<%
									}else{
								%>
									<div id="viewerEvaluDiv" style="width:900px;height:800px;display: none"></div>
								<%
									}
								%>
						</div>
						
					</div>
				</div>
		</h:form>
		<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
		<script type="text/javascript">
		$(function(){
			
			//标签
			$('#myTab a').click(function (e) {
			  	e.preventDefault();
			  	$(this).tab('show');
			});
			
			
			//这部分是布局框架，必须最后加载！
		     windowResize();
		     $(window).resize(function() {
		     	windowResize();
		     });
		});
		function windowResize(){     
			if(768>=$(window).width()){
				$('#main').css('height','auto');
			}else{
				var h2=$('#header').height() || $('#header').outerHeight(true);
				var h1=$('#footer').height() || $('#footer').outerHeight(true); ;
				var h3=$(window).height() || $(document.body).outerHeight(true);
				var h= h3 - h1 - h2;
				$('#main').css('height','auto');
				$('#content').css('height','100%');
				$('#sidebar').css('height','100%');
				if($('#sidebar').height() >= h){
					if($('#sidebar').height() >= $('#content').height()){
						$('#main').css('height',$('#sidebar').height());
					}else{
						$('#main').css('height',$('#content').height());
					}
				}else if($('#content').height()>= h){
					if($('#sidebar').height() >= $('#content').height()){
						$('#main').css('height',$('#sidebar').height());
					}else{
						$('#main').css('height',$('#content').height());
					}
				}else{
					$('#content').css('height','100%');
					$('#sidebar').css('height','100%');
					$('#main').css('height','auto');
					$('#main').css('height',h);
				}
			
			}
		}
		var outline = false ;
		outlinep = '<%=outline%>' ;
		outlineUrl = '<%=outlineUrl%>' ;
		function onLoadOutline(){
			if(outline || outlinep == null || outlinep == '' || outlinep == 'null')
				return ;
			var flag = document.getElementById("formid:showEditOutlineFlagId").value;
		     if(!flag || flag == 'false'){
		    	 outline = true ;
		    	 var a  = '<%=outlineIsPDF%>' ;
		    	 if( a == 'true'){
		    		 $('#pdfDivID').show();
		    	 }else{
		    		 //document.write(tmh__make_ad_fodder(outlineUrl, 900, 800));
		    		 $('#viewerPlaceHolder').show();
		    		 $('#viewerPlaceHolder').html(tmh__make_ad_fodder(outlineUrl, 900, 800));
		    	 }
		     }else{
		     	$('#viewerPlaceHolder').hide();
		     	var val = document.getElementById("formid:hideOutlineId").value; 
		 	    document.getElementById("formid:showOutlineDiv").innerHTML = val ;
		     }
		}
		var evalue = false ;
		var evalP = '<%=eval%>';
		function onLoadEvalu(){
			if(evalue || evalP == null || evalP == '' || evalP == 'null')
				return ;
			flag = document.getElementById("formid:showEditEvaluationId").value;
		     if(!flag || flag == 'false'){
		    	 evalue = true ;
		    	 var a  = '<%=evaluIsPDF%>' ;
		    	 if( a == 'true'){
		    		 $('#pdfEvaluDivID').show();
		    	 }else{
		    		 var evaluUrl = '<%= evaluUrl%>' ;
		    		 $('#viewerEvaluDiv').show();
		    		 $('#viewerEvaluDiv').html(tmh__make_ad_fodder(evaluUrl, 900, 800));
		    	 }
		     }else{
		    		$('#viewerEvaluDiv').hide();
		    		document.getElementById("formid:showOEvauDiv").innerHTML = document.getElementById("formid:hideCourseEvaId").value;
		     } 
		}
		
		function tmh__make_ad_fodder(src, width, height){ 
        	src = src.replace(" ", ""); 
        	var TEMP_IMAGE = '<img src="'+src+'" height='+height+'" width="'+width+'" border="0" />'; 
        	var TEMP_FLASH = '<div id="viewerPlaceHolder" style="width:900px;height:800px;margin-left:100px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' 
        	+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" ' 
        	+ ' height="'+height+'" width="'+width+'"> ' 
        	+ '<param name="movie" value="'+src+'" /> ' 
        	+ '<param name="quality" value="high" /> ' 
        	+ '<param name="wmode" value="opaque" /> ' 
        	+ '<EMBED src="'+src+'" quality="high" WIDTH="'+width+'" HEIGHT="'+height+'" ' 
        	+ ' wmode="opaque" TYPE="application/x-shockwave-flash" ' 
        	+ ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> ' 
        	+ '</object></div>'; 
        	return (/\.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE) 
        	.replace(/\$src\$/gi, src) 
        	.replace(/\$width\$/gi, width) 
        	.replace(/\$height\$/gi, height);
    	}
		$(document).ready(function() {
			//document.getElementById('viewDiv').scrollIntoView();
		});
		</script>
	</body>
</f:view>
</html>
